package com.springboot.redis;

import com.springboot.redis.pojo.User;
import com.springboot.redis.utils.RedisUtill;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: redis
 * @description:
 * @author: wlg
 * @create: 2021-08-09 13:55:04
 **/
@RestController
public class UserController {
    @Autowired
    private RedisUtill redisUtill;

    @RequestMapping("/user/{id}")
    public Object getUser(@PathVariable Long id){
        User user = (User)redisUtill.get("user:"+id);
        return user;
    }
}
